#pragma once
//#include <mmreg.h>
#include "cmediatypes.hpp"

namespace MkvMux
{

class Filter;

class Pin : public IPin
{
    Pin& operator=(const Pin&);
    
protected:

    Pin(Filter*, const wchar_t*, PIN_DIRECTION);
    virtual ~Pin();
    
public:
    
    Filter* const m_pFilter;
    const wchar_t* const m_id;
    const PIN_DIRECTION m_dir;
    IPin* m_connection;
    CMediaTypes m_preferred;
    CMediaTypes m_connection_mt;  //only one of these    
    
    //IUnknown interface:
    
    //IPin interface:

    //HRESULT STDMETHODCALLTYPE Connect( 
    //    IPin *pReceivePin,
    //    const AM_MEDIA_TYPE *pmt);

    //HRESULT STDMETHODCALLTYPE ReceiveConnection( 
    //    IPin*,
    //    const AM_MEDIA_TYPE*);
    
    HRESULT STDMETHODCALLTYPE Disconnect();
    
    HRESULT STDMETHODCALLTYPE ConnectedTo(IPin**);
    
    HRESULT STDMETHODCALLTYPE ConnectionMediaType( 
        AM_MEDIA_TYPE*);
    
    HRESULT STDMETHODCALLTYPE QueryPinInfo( 
        PIN_INFO*);
    
    HRESULT STDMETHODCALLTYPE QueryDirection( 
        PIN_DIRECTION*);
    
    HRESULT STDMETHODCALLTYPE QueryId(LPWSTR*);
    
    //HRESULT STDMETHODCALLTYPE QueryAccept( 
    //    const AM_MEDIA_TYPE*);
    
    HRESULT STDMETHODCALLTYPE EnumMediaTypes(IEnumMediaTypes**);
    
    //HRESULT STDMETHODCALLTYPE QueryInternalConnections( 
    //    IPin**,
    //    ULONG*);
    
    //HRESULT STDMETHODCALLTYPE EndOfStream();
    //    
    //HRESULT STDMETHODCALLTYPE BeginFlush();
    //
    //HRESULT STDMETHODCALLTYPE EndFlush();
    //
    //HRESULT STDMETHODCALLTYPE NewSegment( 
    //    REFERENCE_TIME tStart,
    //    REFERENCE_TIME tStop,
    //    double dRate);
    
protected:

    virtual HRESULT OnDisconnect();
    
};

}  //end namespace MkvMux

